package com.lgxy.xuexi1;

public class AnimalDemo {
    public static void main(String[] args){
        //创建对象,按照多态的方式
        Animal a = new Cat();
        a.setName("小猫");
        a.setAge(5);
        System.out.print(a.getName()+","+a.getAge());
        a.eat();
        Animal a1 = new Cat("加菲",5);
        System.out.print(a1.getName()+","+a1.getAge());
        a.eat();
    }
}
